import { mysqlTable } from "drizzle-orm/mysql-core";
import { int, varchar } from "drizzle-orm/mysql-core";
import { users } from "./users";
import { timestamps } from "./common";
import categories from "./categories";

const posts = mysqlTable("posts", {
  id: int().primaryKey().autoincrement(),
  title: varchar({ length: 256 }),
  content: varchar({ length: 256 }),
  ownerId: int("owner_id").references(() => users.id),
  categoryId: int("category_id").references(() => categories.id),
  thumbimage: varchar({ length: 256 }),
  ...timestamps,
})

export default posts;
